public static boolean matching(String a) {
if (a.length() < 3)
return true;
return a.substring(0, 3).equals(a.substring(a.length() - 3));
}
| Function Call | Return Value | |||
|---|---|---|---|---|
| matching("end end") | → | |||
| matching("Hello") | → | |||
| matching("World") | → | |||
| matching("Hi") | → | |||
| matching("") | → | |||
| matching("????????") | → | |||
Experiment with this code on Gitpod.io